'''
@project:tinyshop_t174
@auther:zhongyingjie
@file:tysphd_tjsp.py
@date:2022/11/8 21:39
@desc:
'''
import time
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from common.broswersetting import broswersetting


class TinyshopTJ(broswersetting):
    def test_TJ01(self):
        self.tiny_htzh('admin', '123456', 'aaaa')
        # 添加
        self._testMethodName = '验证添加是否成功'
        self.tiny_tj('苹果电脑', '00010', '0001', '100', '8000', '10000', '6000')  # 添加商品中心

        try:
            self.assertNotIn("提交", self.driver.page_source)
        except Exception as e:
            self.driver.get_screenshot_as_file('F:\\csxm\\tinyshop_t174\\images' + self._testMethodName + '.png')  # 截图
            raise

    def test_TJ02(self):
        self.tiny_htzh('admin', '123456', 'aaaa')
        # 添加
        self._testMethodName = '验证添加是否成功'
        self.tiny_tj('苹果电脑', 'su', '0001', '100', '8000', '10000', '6000')  # 添加商品中心

        try:
            self.assertNotIn("提交", self.driver.page_source)
        except Exception as e:
            self.driver.get_screenshot_as_file('F:\\csxm\\tinyshop_t174\\images' + self._testMethodName + '.png')  # 截图
            raise

    def test_TJ03(self):
        self.tiny_htzh('admin', '123456', 'aaaa')
        # 添加
        self._testMethodName = '验证添加是否成功'
        self.tiny_tj('苹果电脑', '00010', '0001', 'dd', '8000', '10000', '6000')  # 添加商品中心

        try:
            self.assertNotIn("提交", self.driver.page_source)
        except Exception as e:
            self.driver.get_screenshot_as_file('F:\\csxm\\tinyshop_t174\\images' + self._testMethodName + '.png')  # 截图
            raise
    def test_TJ04(self):
        self.tiny_htzh('admin', '123456', 'aaaa')
        # 添加
        self._testMethodName = '验证添加是否成功'
        self.tiny_tj('苹果电脑', '00010', 'ss', '100', '8000', '10000', '6000')  # 添加商品中心

        try:
            self.assertNotIn("提交", self.driver.page_source)
        except Exception as e:
            self.driver.get_screenshot_as_file('F:\\csxm\\tinyshop_t174\\images' + self._testMethodName + '.png')  # 截图
            raise
    def test_TJ05(self):
        self.tiny_htzh('admin', '123456', 'aaaa')
        # 添加
        self._testMethodName = '验证添加是否成功'
        self.tiny_tj('苹果电脑', '00010', '0001', '100', 'dd', '10000', '6000')  # 添加商品中心

        try:
            self.assertNotIn("提交", self.driver.page_source)
        except Exception as e:
            self.driver.get_screenshot_as_file('F:\\csxm\\tinyshop_t174\\images' + self._testMethodName + '.png')  # 截图
            raise
if __name__ == '__main__':
    unittest.main()
